home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
4490
/
4490.xpi
/
components
/
scripts
/
aol.js
next >
Wrap
Text File
|
2010-01-07
|
3KB
|
100 lines
/***********************************************************
AOL
***********************************************************/
var supportInboxOnly=true;
function init(){
this.initStage=ST_PRE;
this.loginData=["https://my.screenname.aol.com/_cqr/login/login.psp"];
this.dataURL="http://webmail.aol.com/Lite/MsgList.aspx?showUserFolders=True";
this.mailURL="http://webmail.aol.com/";
this.mailDomain="webmail.aol.com";
}
function getCount(aData){
return this.mailCount;
}
function getCount0(aData){
var fnd=aData.match(/setMessageCounts\((\d+)/);
if(fnd){
return fnd[1];
}else{
return -1;
}
}
function getCount1(aData){
var re=/<div class=\"navItem userFolder.+?<\/div>.+?(?:\((\d+)\))?<\/a><\/div>/g;
var o;
var num=0;
while ((o = re.exec(aData)) != null){
if(o[1])num+=parseInt(o[1]);
}
return num;
}
function process(aHttpChannel, aData) {
switch(this.stage){
case ST_PRE:
this.getHtml("http://webmail.aol.com");
return false;
case ST_PRE_RES:
var fnd=aData.match(/<iframe.+id\s*=\s*[\"\']snsModule[\"\'].+src=\"(\S+?)\"/);
if(fnd){
this.getHtml(fnd[1]);
return false;
}
case ST_PRE_RES+1:
var reg=new RegExp("<form.+name\\s*=\\s*[\"\']AOLLoginForm[\"\']([\\S\\s]+?)<script");
var s=aData.match(reg);
if(s){
s=s[1].match(/<input.+?[^-]>/g);
var post="";
for(var i in s){
var t=s[i].match(/<input.+name\s*=s*[\"\'](\S+)[\"\'].+value\s*=\s*[\"\'](\S*)[\"\']/);
if(t){
if(post)post+="&";
post+=t[1]+"="+encodeURIComponent(t[2]);
}
}
this.loginData[LOGIN_DATA]=post;
}
this.stage=ST_LOGIN;
case ST_LOGIN:
var ar=this.user.split("@");
var user=this.user;
if(ar[1]=="aol.com" || ar[1] =="aim.com" || ar[1]=="netscape.net" || ar[1] =="aol.fr" || ar[1] =="aol.de" || ar[1] =="cs.com" || ar[1]=="aol.co.uk") {
user=ar[0];
}
this.loginData[LOGIN_POST]="loginId="+encodeURIComponent(user)
+"&password="+encodeURIComponent(this.password);
this.getHtml(this.loginData[LOGIN_URL],this.loginData[LOGIN_POST]+"&"+this.loginData[LOGIN_DATA]);
return false;
case ST_LOGIN_RES:
var fnd=aData.match(/checkErrorAndSubmitForm\(.+?,.+?,\s*?\'(\S+?)\'/);
if(fnd){
this.getHtml(fnd[1]);
return false;
}
break;
case ST_LOGIN_RES+1:
this.stage=ST_DATA;
case ST_DATA:
this.getHtml("http://webmail.aol.com/Lite/MailCounts.aspx");
this.stage=ST_DATA_RES+1;
return true;
case ST_DATA_RES+1:
this.mailCount=parseInt(this.getCount0(aData));
if(this.inboxOnly||this.mailCount<0){
this.stage=ST_DATA_RES;
break;
}else{
this.getHtml(this.dataURL);
return false;
}
case ST_DATA_RES+2:
this.mailCount+=parseInt(this.getCount1(aData));
this.stage=ST_DATA_RES;
break;
}
return this.baseProcess(aHttpChannel, aData);
}